project(AndroidBinder)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_CXX_FLAGS "-Wall -Wextra -Werror")
if(${ANDROID_ABI} STREQUAL "armeabi-v7a")
    include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
    include_directories(${ANDROID_SYSROOT}/usr/include/aarch64-linux-android)
else()
    include_directories(${ANDROID_SYSROOT}/usr/include/arm-linux-androideabi)
endif()

include_directories(../libs/include ./include)
set(SRCS IInterface.cpp Parcel.cpp IBatteryStats.cpp
  BufferedTextOutput.cpp AppOpsManager.cpp IResultReceiver.cpp
  PersistableBundle.cpp IPermissionController.cpp IPCThreadState.cpp
  IpPrefix.cpp IShellCallback.cpp IAppOpsService.cpp BpBinder.cpp
  PermissionCache.cpp TextOutput.cpp IActivityManager.cpp ProcessState.cpp
  MemoryHeapBase.cpp MemoryDealer.cpp IProcessInfoService.cpp
  IServiceManager.cpp Debug.cpp Static.cpp IMemory.cpp ProcessInfoService.cpp
  Value.cpp IMediaResourceMonitor.cpp MemoryBase.cpp IAppOpsCallback.cpp
  Status.cpp Binder.cpp )
add_library(binder ${SRCS})

link_directories(../libs/arm64-v8a)

add_executable(helloworld demos/helloworld.cpp)
target_link_libraries(helloworld binder utils cutils base log)
